<template>
    <div class="map" ref="baiduRef"></div>
</template>
<script setup>
import {ref,onMounted} from 'vue'
const baiduRef = ref()
const map = ref()
const point = ref()

function initMap (lng = 116.405725, lat = 39.935362) {
    map.value = new BMap.Map(baiduRef.value);
    point.value = new BMap.Point(lng, lat);
    
    map.value.centerAndZoom(point.value, 15);
    map.value.enableScrollWheelZoom(true); //滚轮缩放
}
onMounted(() => {
    //百度js文件加载完成后再执行相关代码
    window.onload = ()=>{
        initMap()
    }
    
})
</script>
<style lang="scss" scoped>
</style>